#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
  int istack = 222;
  switch(vfork()) {
  case -1:
    printf("Failed to vfork\n");
  case 0: //child process
    sleep(3);
    write(STDOUT_FILENO, "Child executing\n", 16);
    istack *= 3;
    _exit(EXIT_SUCCESS);
  default:
    write(STDOUT_FILENO, "Parent executing\n", 17);
    printf("istack = %d\n", istack);
    exit(EXIT_SUCCESS);
  }
}
